package Test6.LNode;

public class Node {
    private Object data;
    private Node next;

    public Node(){
        this.data=null;
        this.next=null;
    }
    public Node(Object data){
        this.data=data;
        this.next=null;
    }

    public void setData(Object data){
        this.data=data;
    }

    public Object getData(){
        return this.data;
    }

    public Node getNext() {
        return this.next;
    }

    public void setNext(Node next){
        this.next=next;
    }

    @Override
    public String toString(){
        StringBuilder s=new StringBuilder();
        s.append("{").append(this.data);
        Node n=next;
        while(n!=null){
            s.append(",").append(n.getData());
            n=n.getNext();
        }
        s.append("}");
        return s.toString();
    }

    @Override
    public boolean equals(Object obj){
        return (this.data==obj?true:false);
    }
}
